from rsspackrat.main.config import CONF_PATH
import os
import yaml

TEMPLATE = {
            'background-color':'#000000',
            'image_quality':1,
            'archive_location':"",
            'save_images':True,
            'save_movies':False,
            'save_music':False,
            'save_text':False,
        }

if not os.path.exists(CONF_PATH):    #create the file
    f = open(CONF_PATH, 'w')
    yaml.dump(TEMPLATE, f)
    f.close()

def save(settings):
    f = open(CONF_PATH, 'w')    #XXX: there's a posibility of screwup
    yaml.dump(settings, f)
    f.close()
    
def load():
    f = open(CONF_PATH, 'r')
    return yaml.load(f)